import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '测站编码',
    align:"center",
    dataIndex: 'stcd'
   },
   {
    title: '测站名称',
    align:"center",
    dataIndex: 'stnm'
   },
   {
    title: '时间',
    align:"center",
    dataIndex: 'tm',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '库上水位',
    align:"center",
    dataIndex: 'rz'
   },
   {
    title: '入库流量',
    align:"center",
    dataIndex: 'inq'
   },
   {
    title: '蓄水量',
    align:"center",
    dataIndex: 'w'
   },
   {
    title: '库下水位',
    align:"center",
    dataIndex: 'blrz'
   },
   {
    title: '出库流量',
    align:"center",
    dataIndex: 'otq'
   },
   {
    title: '库水特征码',
    align:"center",
    dataIndex: 'rwchrcd'
   },
   {
    title: '库水水势',
    align:"center",
    dataIndex: 'rwptn'
   },
   {
    title: '入流时段长',
    align:"center",
    dataIndex: 'inqdr'
   },
   {
    title: '测流方法',
    align:"center",
    dataIndex: 'msqmt'
   },
   {
    title: '汛限水位',
    align:"center",
    dataIndex: 'fsltdz'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '测站编码',
    field: 'stcd',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入测站编码!'},
          ];
     },
  },
  {
    label: '测站名称',
    field: 'stnm',
    component: 'Input',
  },
  {
    label: '时间',
    field: 'tm',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入时间!'},
          ];
     },
  },
  {
    label: '库上水位',
    field: 'rz',
    component: 'Input',
  },
  {
    label: '入库流量',
    field: 'inq',
    component: 'Input',
  },
  {
    label: '蓄水量',
    field: 'w',
    component: 'Input',
  },
  {
    label: '库下水位',
    field: 'blrz',
    component: 'Input',
  },
  {
    label: '出库流量',
    field: 'otq',
    component: 'Input',
  },
  {
    label: '库水特征码',
    field: 'rwchrcd',
    component: 'Input',
  },
  {
    label: '库水水势',
    field: 'rwptn',
    component: 'Input',
  },
  {
    label: '入流时段长',
    field: 'inqdr',
    component: 'Input',
  },
  {
    label: '测流方法',
    field: 'msqmt',
    component: 'Input',
  },
  {
    label: '汛限水位',
    field: 'fsltdz',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}